<?php

namespace app\admin\controller\goods;

use app\common\controller\AdminController;
use EasyAdmin\annotation\ControllerAnnotation;
use EasyAdmin\annotation\NodeAnotation;
use think\App;
use think\facade\View;
use app\admin\model\MallGoods;

/**
 * @ControllerAnnotation(title="砍价活动表")
 */
class BargainController extends AdminController
{

    use \app\admin\traits\Curd;

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->model = new \app\admin\model\Bargain();
    }

    public function goodsAdd()
    {
        return View::fetch();
    }
    public function goodsList()
    {
        $goodsInfo =  MallGoods::paginate(5);
        if (empty($goodsInfo)) {
            return json(['code' => 0, 'msg' => '失败', 'data' => '']);
        } else {
            $goodsInfo = $goodsInfo->toArray();
            return json(['code' => 0, 'msg' => '成功', 'count' => $goodsInfo['total'], 'data' => $goodsInfo['data']]);
        }
    }
//    public function pinkAdd()
//    {
//        $post = $this->request->get();
//       View::assign(['data'=>$post]);
//       return View::fetch('add');
//    }



    
}